<button class="btn btn-success btn-xs" data-toggle="modal" data-target="#wagesEdit{{ $id }}">编辑</button>

<div class="modal fade" id="wagesEdit{{ $id }}" tabindex="-1" role="dialog" aria-labelledby="wagesEdit" aria-hidden="true">
    <div class="modal-dialog modal-xs">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="font-size: 36px;">&times;</button>
                <h4 class="modal-title" id="myModalLabel">编辑</h4>
            </div>
            <div class="modal-body">
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">员工</label>
                    <select name="stuff{{ $id }}" class="form-control">
                        <option value="">请选择员工</option>
                        @if(!empty($stuff))
                            @foreach($stuff as $key => $value)
                                @if($data->user_id === $key)
                                    <option value="{{ $key }}" selected>{{ $value }}</option>
                                @else
                                    <option value="{{ $key }}">{{ $value }}</option>
                                @endif
                            @endforeach
                        @endif
                    </select>
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">基本薪资</label>
                    <input type="number" name="basicWages{{ $id }}" value="{{ $data->basic_wages }}" class="form-control" placeholder="请输入基本薪资">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">提成</label>
                    <input type="number" name="commission{{ $id }}" value="{{ $data->commission }}" class="form-control" placeholder="请输入提成">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">应扣费用</label>
                    <input type="number" name="deduct{{ $id }}" value="{{ $data->deduct }}" class="form-control" placeholder="请输入应扣费用">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">实发工资</label>
                    <input type="number" name="actualWages{{ $id }}" value="{{ $data->actual_wages }}" class="form-control" placeholder="请输入实发工资">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">日期</label>
                    <input type="date" name="date{{ $id }}" value="{{ $data->date }}" class="form-control" placeholder="请选择日期">
                </div>
                <div class="mb-3">
                    <label for="exampleFormControlInput1" class="form-label">备注</label>
                    <textarea name="remark{{ $id }}" class="form-control" placeholder="请输入备注">
                        {{ $data->remark }}
                    </textarea>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="wagesEdit({{ $id }})">提交</button>
            </div>
        </div>
    </div>
</div>
<script>
    function wagesEdit(id)
    {
        ajaxPostFunc('/admin/ajax/wagesEdit', {
            id:id,
            stuff: $("select[name='stuff"+id+"'] option:selected").val(),
            basic_wages: $("input[name='basicWages"+id+"']").val(),
            commission: $("input[name='commission"+id+"']").val(),
            deduct: $("input[name='deduct"+id+"']").val(),
            actual_wages: $("input[name='actualWages"+id+"']").val(),
            date: $("input[name='date"+id+"']").val(),
            remark: $("textarea[name='remark"+id+"']").val(),
            _token: $.admin.token
        }, {}, res => {
            console.log(res);
            window.location.reload();
        });
    }
</script>
